import datetime

from django.db import models


# Create your models here.

# 基类

class User(models.Model):
    username = models.CharField(max_length=100, verbose_name='用户名')
    password = models.CharField(max_length=200, verbose_name='用户密码')
    addr = models.CharField(max_length=500, verbose_name='地址')
    name = models.CharField(max_length=100, verbose_name='真实姓名')
    id_number = models.CharField(max_length=100, verbose_name='身份证号')
    money = models.FloatField(default=0)
    number_shares = models.IntegerField(default=0, verbose_name='股数')


# class City(models.Model):
#     areaname = models.CharField(max_length=100, verbose_name='地名')
#     level = models.IntegerField(verbose_name='等级')
#     parentid = models.IntegerField(verbose_name='上级id')
#
#     class Meta:
#         db_table = 'city'


class Hui(models.Model):
    update = models.CharField(max_length=100, verbose_name='该数据查询日期')
    json = models.CharField(max_length=2000, verbose_name='数据')


class RTHui(models.Model):
    date = models.CharField(max_length=100, verbose_name='查询日期')
    time = models.CharField(max_length=100, verbose_name='查询时间')
    json = models.CharField(max_length=2000, verbose_name='数据')


class Order1(models.Model):
    uid = models.IntegerField(verbose_name='用户id')
    order_id = models.CharField(max_length=500, verbose_name='订单号')
    total = models.FloatField(verbose_name='金额')
    create = models.DateTimeField(auto_now_add=True, verbose_name='创建时间')


class Order2(models.Model):
    uid = models.IntegerField(verbose_name='用户id')
    order_id = models.CharField(max_length=500, verbose_name='订单号')
    total = models.FloatField(verbose_name='金额')
    create = models.DateTimeField(auto_now_add=True, verbose_name='创建时间')


class Good(models.Model):
    name = models.CharField(max_length=200)
    number = models.IntegerField(default=50)


class TransactionOrder(models.Model):
    uid = models.IntegerField(verbose_name='用户id')
    order_type = models.CharField(max_length=50, verbose_name='订单类型')
    price = models.FloatField(verbose_name='价格')
    number_shares = models.IntegerField(verbose_name='股数')
    create = models.DateTimeField(auto_now_add=True, verbose_name='创建时间')


class Deal(models.Model):
    buy_uid = models.IntegerField(verbose_name='买家id')
    sell_uid = models.IntegerField(verbose_name='卖家id')
    price = models.FloatField(max_length='价格')
    number_shares = models.IntegerField(verbose_name='股数')
    create = models.DateTimeField(auto_now_add=True, verbose_name='创建时间')
